package com.moonbird.springboot.service;

import com.moonbird.springboot.DTO.Result;
import com.moonbird.springboot.Utils.BigModelNew;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;


/**
 * @author hpl
 */
@Service
@Slf4j
public class ChatService {

    public Result<String> sendMessage(String message) {
        try {
            BigModelNew bigModel = new BigModelNew("userId", false);
            // 调用处理问题并获取结果的方法
            String question = message;
            String answer = bigModel.processQuestion(question);
            System.out.println("question: " + question);
            System.out.println("answer: " + answer);
            // 处理返回的答案
            return Result.success(answer);
        } catch (Exception e) {
            e.printStackTrace();
            return  Result.fail(e.getMessage());
        }
    }
}
